package cqrtplm.mapper;

import com.hustcad.plm.pdm.doc.vo.IbaAttributeVO;
import com.hustcad.plm.pdm.file.handler.response.ResponseResult;
import com.ty.basic.dto.IbaAttributeDTO;
import cqrtplm.dto.DspfDemandDevpDTO;
import cqrtplm.dto.DspfStatusModuleitemsubDTO;
import cqrtplm.dto.RtCfgStatusDTO;
import cqrtplm.dto.SubModuleDataDTO;
import cqrtplm.dto.thirdPartyAPI.MomValueDTO;
import cqrtplm.dto.thirdPartyAPI.RestAdapterMomDTO;
import cqrtplm.entity.RTDescribeInformationDO;
import cqrtplm.entity.RtCfgBomDO;
import cqrtplm.entity.RtCfgStatusInfoDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cqrtplm.entity.RtCfgStatusInfodetailDO;
import cqrtplm.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;

/**
 * @author 博
 * @description 针对表【RT_CFG_STATUS_INFO】的数据库操作Mapper
 * @createDate 2025-06-30 22:04:43
 * @Entity cqrtplm.entity.RtCfgStatusInfoDO
 */
public interface RtCfgStatusInfoMapper extends BaseMapper<RtCfgStatusInfoDO> {


    TemplateInfoVO selectPartOidByMasterOid(BigInteger alternateObjectMasterOid);

    RtCfgStatusInfoDO selectByModuleId(RtCfgStatusDTO dto);

    RtCfgStatusInfoDO selectByStatusCode(RtCfgStatusDTO dto);

    Long insertByRtCfgStatusInfo(RtCfgStatusInfoDO rtCfgStatusInfoDO);

    int updateByStatusId(RtCfgStatusInfoDO rtCfgStatusInfoDO);


    List<String> getProductType(@Param("name") String name,@Param("type") String type);



    // Oracle分页查询使用ROWNUM
    List<ProductCodeAndDescriptionVO> selectProductCodeList(@Param("dtoList") List<StatusInfoDescriptionVO> dtoList,
                                                            @Param("start") long start,
                                                            @Param("end") long end);

    long countProductCode(@Param("dtoList") List<StatusInfoDescriptionVO> dtoList);



    String selectByObjbaseOid(@Param("fatherOid") String fatherOid,@Param("modelManager") String modelManager);

    List<TemplateInfoVO> getDefaultTemplate(@Param("refType") String refType,@Param("type") String type,@Param("defaultTemplate") String defaultTemplate);

    TemplateInfoVO getDefaultTemplateLatest(@Param("refType") String refType,@Param("type") String type,@Param("defaultTemplate") String defaultTemplate);

    List<StatusInfoDetailContentVO> selectTyDetByOids(List<String> list);

    Long deleteBatchByInfoIds(String[] infoIds);

    RtCfgStatusInfoDO selectByStatusId(@Param("statusId") String statusId);

    List<StatusInfoDetailContentVO> selectStatusIdByRefermbomCode(String refermbomcode);

    List<RTDescribeInformationDO> selectEngraveByProductType(@Param("producttype") String producttype,@Param("clientrecordtype") String  clientrecordtype);

    boolean existsByDevCodeOrProductType(@Param("attributeName") String attributeName, @Param("attributeValue") String attributeValue, @Param("oid") String oid);

    String selectMoudleByProductType(@Param("productType") String productType, @Param("productTypeValue") String productTypeValue,
                                     @Param("devCode") String devCode, @Param("devCodeValue") String devCodeValue);

    Long selectTypeOidByTypeName(String s);

    RtCfgStatusInfoDO selectStatusInfoByStatusCode(String demandCode);

    @Update("update RT_CFG_STATUS_INFO set status=3 where oid=${oid}")
    void updateByOid(@Param("oid") BigInteger oid);

    List<ParentBomVO> selectByEBomOid(Long oid);

    String selectInfoidByFatheroid(Long oid,String statuscode);

    BigInteger selectViewoidByViewRefName(String viewRefName);

    String selectScgcBystatusid(String statusid);

    List<StatusInfoDetailContentVO> selectCertificationRequirements();

    @Select("select MASTEREDOID as masterOid from TY_PART where oid=#{fatherOid}")
    String getMasterOidByOid(@Param("fatherOid") String fatherOid);

    @Select("select OID as oid from TY_PART where MASTEREDOID=#{masterOid} and ISLASTITERATED=1")
    String getNowMasterOidByOid(@Param("masterOid") String masterOid);

    String getStatusIdByProductCode(String productcode);

    List<String> selectByEBomCode(String ebomcode);

    @Update("update RT_CFG_STATUS_INFO set ZMCHENGBOM=#{productCodeZD},DMCHENGBOM=#{productCodeDL},CDCHENGBOM=#{productCodeCD},status=4 where STATUSID=#{statusid}")
    void updateProductCodeByStatusid(@Param("productCodeZD") String productCodeZD,
                                     @Param("productCodeDL") String productCodeDL,
                                     @Param("productCodeCD") String productCodeCD,
                                     @Param("statusid") String statusid);

    List<IbaAttributeValueVO> selectIbaBypartNumbers(@Param("partNumber") String partNumber, @Param("attributeIdList") List<String> attributeIdList, @Param("productType") String productType);


    void updateManagerByXqCode(DspfDemandDevpDTO dto);
    List<LikeBomVO> getRtCfgPartByPartNumber(@Param("partsCode") String partsCode,
                                             @Param("productType") String productType,
                                             @Param("typeotype") String typeotype);

    List<ModelAndProductTypeVO> selectDynamicByProductType();

    List<MomValueDTO> selectModulesubByMid(@Param("moduleid") String moduleid);

    List<StatusInfoDetailContentVO> selectEbomMastered(@Param("ebomMasteredoid") String ebomMasteredoid);

    List<StatusInfoDetailContentVO> selectCretBySaletocountry(@Param("id") String id,@Param("salesareas") String salesareas);

    List<StatusInfoDetailContentVO> selectcretAllBycountryAndDevCode(@Param("productLine") String productLine,@Param("salesareas") String salesareas);

    List<RtCfgStatusInfodetailDO> selectSorceContentByReferMbomCode(String refermbomcode);

    List<RtCfgStatusInfodetailDO> selectSorceContentByEbomCode(String ebomcode);

    String selectModulePartNumberByModuleId(String moduleId);

    Integer inspectStopFlag(String code);

    List<RtCfgStatusInfodetailDO> selectdetailByStatusId(String statusid);

    BigInteger selectDataItemByNname(String dataItemCode);

    List<LikeBomVO> getRtCfgPartByPartNumberTwo(@Param("partsCode") String partsCode,
                                                @Param("devCode") String devCode,
                                                @Param("typeotype") String typeotype);

    List<ProductCodeAndDescriptionVO> getAllBomCode();

    String selectDevCodeByProductType(String producttype);

    @Select("select SELECTVALUENAME as rzvalue from RT_CFG_STATUS_INFODETAIL where INFOID=#{statusid} and DESCRNAME='认证要求'")
    String selectRzByInfoid(@Param("statusid") String statusid);

    List<SubModuleDataDTO> selectModuleDataByStatusId(@Param("partsCode") String partsCode,@Param("statusid") String statusid);

    List<RtCfgStatusInfoDO> selectByStatusCodeList(RtCfgStatusDTO dto);

    List<RTEngraveDemandStatusVO> selectStatusInfoDetailContentDOByPoid(@Param("poid") BigInteger poid ,@Param("childrenNname") List<String> childrenNname);

    String selectCertificationRequirementsByCertName(String valueex);

    @Select("SELECT OID,OTYPE FROM TY_WORKFLOW_CONTAINER WHERE CODE=#{flowCode}")
    Map getFlowDataByFlowCode(@Param("flowCode") String flowCode);

    List<String> selectPartNumberByDevCode(String devcode);

    StatusInfoDetailContentVO selectdevCodeAndProductTypeByoid(String oid);

    String selectCombcertByoid(String attributeValuex);

    List<StatusInfoDetailContentVO> selectCombcertByCertname(@Param("splitList") List<String> splitList);

    List<StatusInfoDetailContentVO> selectAllCertByBaseCert(@Param("availablecertList") List<String> availablecertList,@Param("salesareas") String salesareas);

    List<RTDescribeInformationDO> selectEngraveByProductTypeTwo(String producttype);

    @Select("SELECT OID as oid FROM RT_CFG_STATUS_INFO WHERE STATUSID=#{statusid}")
    String selectOidByStatausId(@Param("statusid") String statusid);

    List<StatusInfoDetailContentVO> selectTestByRequirements(String attributeValuex);
}




